package com.xw.kotlinlib.base

import androidx.fragment.app.Fragment

abstract class BaseFragment: Fragment() {

    override fun onHiddenChanged(hidden: Boolean) {
        super.onHiddenChanged(hidden)

        //将fragment的显示,隐藏状态传递给viewpager的子fragment
        val fragments = childFragmentManager.fragments
        val count = fragments.size
        for (i in 0 until count) {
            val fragment = fragments[i]
            if (fragment != null && fragment.isResumed) {
                fragment.onHiddenChanged(hidden)
            }
        }
    }
}